import { Component, Input, OnInit, ChangeDetectionStrategy } from '@angular/core';
import {
    trigger,
    state,
    style,
    transition,
    animate
} from '@angular/animations';

const mapping = {
    success: 'glyphicon-ok-sign',
    warning: 'glyphicon-exclamation-sign',
    error: 'glyphicon-exclamation-sign',
    info: 'glyphicon-ok-circle'
}

@Component({
    selector: 'upc-ng-message',
    templateUrl: './message.component.html',
    styleUrls: ['./message.component.scss'],
    changeDetection: ChangeDetectionStrategy.OnPush
})
export class MessageComponent implements OnInit {

    ngOnInit(): void {
        this.typeClass = ['upc-message-' + this.msgType];
        this.typeIconClass = [mapping[this.msgType]];
    }

    @Input() msgType: 'success' | 'info' | 'warning' | 'error' = 'info'

    @Input() payload: string = ''

    private typeClass
    private typeIconClass
}